﻿/*****************************************************************//**
 * @file   VAOneXMLAdaptorNodes.h
 * @brief  VAOne读写节点适配器
 * 
 * @author  lilongyuan (lilongyuan@diso.cn)
 * @date    2025-02-17
 *********************************************************************/
#ifndef VAONEXMLADAPTORNODES_H
#define VAONEXMLADAPTORNODES_H

#include "FITKAbstractVAOneXMLAdaptor.h"

namespace Acoustics
{
    class FITKAcousticsSEANodeList;
}

namespace Core
{
    class FITKNode;
}

namespace IO
{
    /**
     * @brief   VAOne读写节点适配器
     * @author  lilongyuan (lilongyuan@diso.cn)
     * @date    2025-02-17
     */
    class FITKVAOneXMLIOAPI VAOneXMLAdaptorNodes : public FITKAbstractVAOneXMLAdaptor
    {
        FITKCLASS(IO, VAOneXMLAdaptorNodes);
    public:
        /**
         * @brief   构造函数
         * @author  lilongyuan (lilongyuan@diso.cn)
         * @date    2025-02-17
         */
        explicit VAOneXMLAdaptorNodes()= default;
        /**
         * @brief   析构函数
         * @author  lilongyuan (lilongyuan@diso.cn)
         * @date    2025-02-17
         */
        ~VAOneXMLAdaptorNodes() = default;
        /**
         * @brief   适配器读数据
         * @return  是否执行成功
         * @author  lilongyuan (lilongyuan@diso.cn)
         * @date    2025-02-17
         */
        bool adaptR() override;
        /**
         * @brief   适配器写数据
         * @return  是否执行成功
         * @author  lilongyuan (lilongyuan@diso.cn)
         * @date    2025-02-17
         */
        bool adaptW() override;
    private:
        /**
         * @brief     读取Node节点数据
         * @param[i]  node Node节点，discNodeList 离散节点列表数据对象
         * @return    是否执行成功
         * @author    lilongyuan (lilongyuan@diso.cn)
         * @date      2025-02-17
         */
        bool readNode(rapidxml::xml_node<char>* node, Acoustics::FITKAcousticsDiscNodeList* discNodeList);
        /**
         * @brief     读取Node节点数据
         * @param[i]  node Nodes节点，data 节点数据对象，id 节点ID
         * @return    是否执行成功
         * @author    lilongyuan (lilongyuan@diso.cn)
         * @date      2025-02-17
         */
        bool writeNode(rapidxml::xml_node<char>* node, Core::FITKNode* data, int id);
    };

    Register2FITKIOAdaptorFactory(VAOneXML, Nodes, VAOneXMLAdaptorNodes)
}

#endif // VAONEXMLADAPTORNODES_H
